package com.example.transaction.common.enums;

import lombok.Getter;

@Getter
public enum  StepStateEnum {
    INIT(0, "未执行"),
    START(1, "已开始"),
    FINISH_REVIEW(2, "完成待复核"),
    SKIP_REVIEW(3, "跳过待复核"),
    FAIL_REVIEW(4, "失败待复核"),
    FINISH(5, "完成"),
    SKIP(6, "跳过"),
    FAIL(7, "失败"),
    ;
    private Integer code;
    private String name;
    StepStateEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static StepStateEnum ofCode(int code) {
        for (StepStateEnum stepStateEnum : StepStateEnum.values()) {
            if (stepStateEnum.getCode() == code) {
                return stepStateEnum;
            }
        }
        throw new RuntimeException("未找到" + code + "状态");
    }
}
